package May26ch20ex2;

import java.util.ArrayList;
import java.util.List;

public class MyGenericWildcards {
	public static void main(String[] args) {
		List<Integer> integers = new ArrayList<Integer>();
		integers.add(new Integer(10));
		integers.add(new Integer(20));
		integers.add(new Integer(30));
		// System.out.println(integers);
		printlist(integers);
		List<String> strings = new ArrayList<String>();
		strings.add(new String("hello "));
		strings.add(new String("world "));
		// printlist(strings);
		List<Long> longs = new ArrayList<Long>();
		longs.add(100l);
		longs.add(200l);
		longs.add(300L);
		printlist(longs);

	}

	private static void printlist(List<? extends Number> objects) {
		for (Object object : objects) {
			System.out.println(object);
		}
	}

}
